import {Controller, Ctx, Get, Post, Params, Query, Body} from 'koa-ts-controllers';
import {Context} from 'koa';

import cubeStruct from '../define/cubeTypeSubtype'
import CUBE from '../utils/cubeData';
import myStatus from '../define/status'

@Controller('/procedure')
class FlowController {
    @Post('/getData')
    async getData(
        @Ctx() ctx : Context
    ){
        let cubeIns = await CUBE.getinstance();
        console.log(`获取cube实例，其内容是${cubeIns}`);
        let message = cubeIns.recvMessage(cubeStruct.eshop.role.type, cubeStruct.eshop.role.subtype.owner);
        if(message)
        {
            ctx.status = myStatus.httpStatus.post;
            return message;
        }
    }
}